package fina2.i18n;

import java.io.Serializable;

import javax.faces.model.SelectItem;
import javax.naming.InitialContext;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.log.Log;
import org.jboss.seam.log.Logging;

import fina2.dcs.context.ContextHelper;
import fina2.dcs.i18n.LanguageLocal;

@Name("langBean")
@Scope(ScopeType.SESSION)
public class LanguageBean implements Serializable{
	private String selectedLang;

	private SelectItem allLangs[];

	private Log log = Logging.getLog(getClass());

	private InitialContext ic = null;
	private LanguageLocal langLocal = null;

	public void init() {
		try {
			ic = ContextHelper.getInitialContext();
			langLocal = ContextHelper.injectLangLocal(ic);
		} catch (Exception ex) {
			log.error(ex.getMessage(), ex);
		}
	}

	public String getSelectedLang() {
		return selectedLang;
	}

	public void setSelectedLang(String selectedLang) {
		this.selectedLang = selectedLang;
	}

	public SelectItem[] getAllLangs() {
        
		return allLangs;
	}

	public void setAllLangs(SelectItem[] allLangs) {
		this.allLangs = allLangs;
	}

}
